package com.hgkj.cloud.base.service.impl;

import com.hgkj.cloud.base.common.PageInfo;
import com.hgkj.cloud.base.dao.TenantSchemesMapper;
import com.hgkj.cloud.base.domain.TenantSchemes;
import com.hgkj.cloud.base.service.TenantSchemesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TenantSchemesServiceImpl implements TenantSchemesService {

    @Autowired
    private TenantSchemesMapper tenantSchemesMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return tenantSchemesMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TenantSchemes record) {
        return tenantSchemesMapper.insert(record);
    }

    @Override
    public int insertSelective(TenantSchemes record) {
        return tenantSchemesMapper.insertSelective(record);
    }

    @Override
    public TenantSchemes selectByPrimaryKey(Long id) {
        return tenantSchemesMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TenantSchemes record) {
        return tenantSchemesMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TenantSchemes record) {
        return tenantSchemesMapper.updateByPrimaryKey(record);
    }

    @Override
    public TenantSchemes getSchemeByMap(Map<String, Object> map) {
        return tenantSchemesMapper.getSchemeByMap(map);
    }

    @Override
    public List<TenantSchemes> listUserSchemeByUser_id(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantSchemesMapper.listUserSchemeByUser_id(map);
    }

    @Override
    public List<TenantSchemes> listLatestSchemes(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantSchemesMapper.listLatestSchemes(map);
    }

    @Override
    public Long listLatestSchemesByCount(Map<String, Object> map) {
        return tenantSchemesMapper.listLatestSchemesByCount(map);
    }

    @Override
    public List<TenantSchemes> listHistorySchemes(PageInfo pi, Map<String, Object> map) {
        if(pi != null){
            map.put("currentCount", pi.getCurrentCount());
            map.put("pageSize", pi.getPageSize());
        }
        return tenantSchemesMapper.listHistorySchemes(map);
    }

    @Override
    public Long listHistorySchemesCount(Map<String, Object> map) {
        return tenantSchemesMapper.listHistorySchemesCount(map);
    }

    @Override
    public Long listAllSchemesCount(Map<String, Object> map) {
        return tenantSchemesMapper.listAllSchemesCount(map);
    }

    @Override
    public Long listSchemeJoinUserCount(Map<String, Object> map) {
        return tenantSchemesMapper.listSchemeJoinUserCount(map);
    }

    @Override
    public List<Map<String, Object>> statSchemeQuestion(Map<String, Object> map) {
        return tenantSchemesMapper.statSchemeQuestion(map);
    }
}
